<template>
  <div>
    <el-form inline>
      <el-form-item label="请输入">
        <el-input
          v-model="Pagination.carPlate"
          placeholder="车牌/订单号/车主手机号"
          @change="init"
        ></el-input>
      </el-form-item>
      <el-form-item label="订单来源">
        <el-select
          v-model="Pagination.paymentWay"
          placeholder="请选择订单来源"
          @change="init"
        >
          <el-option value="天猫"></el-option>
          <el-option value="天猫平台"></el-option>
          <el-option value="商务端"></el-option>
          <el-option value="淘宝"></el-option>
          <el-option value="微信小程序"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="检测站">
        <el-autocomplete
          v-model="Pagination.stationName"
          :fetch-suggestions="querySearch"
          placeholder="请输入检查站名称"
          @select="handleSelect"
        ></el-autocomplete>
      </el-form-item>
      <el-form-item label="司机">
        <el-autocomplete
          v-model="Pagination.driverName"
          :fetch-suggestions="querydriver"
          placeholder="请输入检查站名称"
          @select="handledriver"
        ></el-autocomplete>
      </el-form-item>

      <el-form-item>
        <el-select
          v-model="Pagination.city"
          placeholder="省份"
          @change="initProvincial"
        >
          <el-option
            :value="item.title"
            v-for="item in addressList"
            :key="item.title"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select
          v-model="Pagination.area"
          placeholder="城市"
          @change="initOrder"
        >
          <el-option
            :value="item.title"
            v-for="(item, index) in city"
            :key="index"
          ></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="订单状态">
        <el-select
          v-model="Pagination.orderState"
          placeholder="请选择订单状态"
          @change="init"
        >
          <el-option value="待开始"></el-option>
          <el-option value="正在进行"></el-option>
          <el-option value="订单完成"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item >
        <el-date-picker
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="init">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table
      :data="orders"
      stripe
      style="width: 100%"
      v-loading="loading"
      @expand-change="OrderDetail"
      :expand-row-keys="expandRows"
      row-key="id"
    >
      <el-table-column type="expand">
        <template #default="scope">
          <el-steps direction="vertical" :active="activevalue">
            <el-step title="预约">
              <template #description>
                <p>车牌:{{ scope.row.carPlate }}</p>
                <p>地址:{{ scope.row.address }}</p>
                <p>预检时间:{{ scope.row.placeTestTime }}</p>
                <p>订单号：{{ scope.row.id }}</p>
              </template>
            </el-step>

            <el-step title="预检">
              <template #description>
                <p>客户姓名:{{ Orderlist.customerName }}</p>
                <p>客户电话:{{ Orderlist.customerPhone }}</p>
                <p>待检司机:{{ Orderlist.driverName }}</p>
                <p>
                  实况照片:
                  <el-image
                    :src="item"
                    v-for="item in Orderlist.pickCarImg &&
                    JSON.parse(Orderlist.pickCarImg)"
                    :key="item"
                    :preview-src-list="JSON.parse(Orderlist.pickCarImg)"
                  >
                    ></el-image
                  >
                </p>
                <p>
                  签字取车
                  <el-image
                    :src="Orderlist.pickCarCustomerSign"
                    :preview-src-list="[Orderlist.pickCarCustomerSign]"
                  >
                    ></el-image
                  >
                  <el-image
                    :src="Orderlist.pickCarDriverSign"
                    :preview-src-list="[Orderlist.pickCarDriverSign]"
                  >
                    ></el-image
                  >
                </p>
              </template>
            </el-step>

            <el-step title="送检"></el-step>
            <el-step title="还车"></el-step>
            <el-step title="归档"></el-step>
          </el-steps>
        </template>
      </el-table-column>

      <el-table-column prop="carPlate" label="车牌"> </el-table-column>
      <el-table-column prop="customerName" label="车主姓名"> </el-table-column>
      <el-table-column prop="customerPhone" label="车主电话"> </el-table-column>
      <el-table-column prop="address" label="提车地址"> </el-table-column>
      <el-table-column prop="placeTestTime" label="预检时间"> </el-table-column>
      <el-table-column prop="carType" label="车型"> </el-table-column>

      <el-table-column prop="placeOrderTime" label="下单时间">
      </el-table-column>
      <el-table-column prop="paymentWay" label="订单来源"> </el-table-column>
      <el-table-column prop="stationName" label="检测站" width="300px">
      </el-table-column>
      <el-table-column prop="driverName" label="代检司机"> </el-table-column>
      <el-table-column prop="orderState" label="订单状态">
        <template slot-scope="scope">
          <el-tag
            v-if="scope.row.orderState === '待开始'"
            type="danger"
            disable-transitions
            effect="dark"
            >{{ scope.row.orderState }}</el-tag
          >
          <el-tag
            v-else-if="scope.row.orderState === '正在进行'"
            type="warning"
            disable-transitions
            effect="dark"
            >{{ scope.row.orderState }}</el-tag
          >
          <el-tag
            v-else-if="scope.row.orderState === '订单完成'"
            type="success"
            disable-transitions
            effect="dark"
            >{{ scope.row.orderState }}</el-tag
          >
        </template>
      </el-table-column>

      <el-table-column fixed="right" label="操作" width="240">
        <template slot-scope="scope">
          <el-button type="primary" size="small" @click="chuanzhi(scope.row)"
            >修改</el-button
          >
          <el-button
            type="info"
            size="small"
            v-if="scope.row.orderState === '订单完成'"
            >结算</el-button
          >

          <el-popconfirm
            icon="el-icon-info"
            icon-color="red"
            title="这是一段内容确定删除吗？"
            @confirm="deletes(scope.row.id)"
          >
            <el-button slot="reference" type="danger" size="small"
              >删除</el-button
            >
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="10"
      layout="total, sizes, prev, pager, next, jumper"
      :total="Pagination.total"
    >
    </el-pagination>

    <el-dialog
      title="订单详情"
      :visible.sync="centerDialogVisible"
      width="80%"
      center
    >
      <el-descriptions class="margin-top" :column="3" border>
        <el-descriptions-item>
          <template slot="label"> 订单id </template>
          {{ tablelist.id }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 车牌号 </template>
          <!-- {{ tablelist.carPlate }} -->
          <el-input
            v-model="tablelist.carPlate"
            placeholder="请输入内容"
          ></el-input>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 车型 </template>
          {{ tablelist.carType }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 客户姓名 </template>
          <!-- {{ tablelist.customerName }} -->
          <el-input
            v-model="tablelist.customerName"
            placeholder="请输入内容"
          ></el-input>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 客户电话 </template>
          <!-- {{ tablelist.customerPhone }} -->
          <el-input
            v-model="tablelist.customerPhone"
            placeholder="请输入内容"
          ></el-input>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 下单时间 </template>
          <!-- {{ tablelist.customerPhone }} -->
          {{ tablelist.placeOrderTime }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 用户检测费 </template>
          <!-- {{ tablelist.customerPhone }} -->
          <el-input
            v-model="tablelist.placeOrderTime"
            :disabled="true"
          ></el-input>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 服务费 </template>
          <!-- {{ tablelist.customerPhone }} -->
          <!-- <el-input v-model="tablelist.placeOrderTime"  :disabled="true"></el-input> -->
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 司机服务费 </template>
          <!-- {{ tablelist.customerPhone }} -->
          <el-input v-model="tablelist.payDriverFee"></el-input>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 检测站费 </template>
          <!-- {{ tablelist.customerPhone }} -->
          <el-input v-model="tablelist.payDriverFee"></el-input>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 订单状态 </template>
          <el-select v-model="tablelist.orderState" placeholder="请选择">
            <el-option value="待开始"></el-option>
            <el-option value="正在进行"></el-option>
            <el-option value="订单完成"></el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 检测站 </template>
          <el-select v-model="tablelist.stationName" placeholder="请选择">
            <el-option value="杭州永畅机动车检测站 (11.108km)"></el-option>
            <el-option value="杭州中驰机动车检测站 (11.919km)"></el-option>
            <el-option
              value="杭州汽车综合性能检测中心有限公司（康桥） (11.943km)"
            ></el-option>
            <el-option value="杭州君安汽车检测有限公司 (12.447km)"></el-option>
            <el-option value="杭州安顺机动车检测站 (13.765km)"></el-option>
            <el-option value="杭州金亿汽车检测有限公司 (19.488km)"></el-option>
            <el-option value="杭州转塘汽车检测有限公司 (19.645km)"></el-option>
            <el-option
              value="杭州临安顺安汽车检测有限公司 (43.058km)"
            ></el-option>
            <el-option
              value="临桐庐天利车辆检测有限公司 (69.067km)"
            ></el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 代检司机 </template>
          <el-select v-model="tablelist.driverName" placeholder="请选择">
            <el-option value="吴国权"></el-option>
            <el-option value="胡伟"></el-option>
            <el-option value="卓燕容"></el-option>
            <el-option value="王翔"></el-option>
            <el-option value="阮家齐"></el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 支付方式 </template>
          {{ tablelist.paymentWay }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 支付状态 </template>
          <el-select
            v-model="tablelist.paymentState"
            placeholder="请选择"
            disabled
          >
            <el-option value="待支付"></el-option>
            <el-option value="已支付"></el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 预检时间 </template>
          <el-date-picker
            v-model="tablelist.placeTestTime"
            type="datetime"
            placeholder="选择日期时间"
            value-format="yyyy-MM-dd HH:mm:ss"
          >
            <!-- value-format="yyyy-MM-dd HH:mm:ss" 转格式  -->
          </el-date-picker>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 提车地址 </template>
          {{ tablelist.address }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 行驶证 </template>
          <el-upload
            :action="$http.defaults.baseURL + '/file/uploadFile'"
            :on-success="uploads"
          >
            <el-button style="font-size: 40px" type="text">+</el-button>
          </el-upload>

          <el-image
            style="width: 100px; height: 100px"
            :src="item"
            v-for="(item, index) in tablelist.merchantLicenseImg"
            :key="index"
            fit="fit"
          ></el-image>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 客服 </template>
          {{ tablelist.staff }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label"> 备注 </template>
          {{ tablelist.remarks }}
        </el-descriptions-item>
      </el-descriptions>
      <el-button type="primary" @click="Submit" style="margin-top: 20px"
        >提交</el-button
      >
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      orders: [],
      Pagination: {
        total: 0,
        pageNum: 1,
        pageSize: 10,
        carPlate: "",
        paymentWay: "",
        stationName: "",
        driverName: "",
      },
      currentPage4: 1,
      loading: true,
      centerDialogVisible: false,
      tablelist: {},
      Orderlist: {},
      activevalue: 1,
      expandRows: [],
      addressList: [
        {
          title: "北京市",
          children: [
            { title: "东城区" },
            { title: "西城区" },
            { title: "朝阳区" },
            { title: "丰台区" },
            { title: "石景山区" },
            { title: "海淀区" },
            { title: "门头沟区" },
            { title: "房山区" },
            { title: "通州区" },
            { title: "顺义区" },
            { title: "昌平区" },
            { title: "大兴区" },
            { title: "怀柔区" },
            { title: "平谷区" },
            { title: "密云区" },
            { title: "延庆区" },
          ],
        },
        {
          title: "天津市",
          children: [
            { title: "和平区" },
            { title: "河东区" },
            { title: "河西区" },
            { title: "南开区" },
            { title: "河北区" },
            { title: "红桥区" },
            { title: "东丽区" },
            { title: "西青区" },
            { title: "津南区" },
            { title: "北辰区" },
            { title: "武清区" },
            { title: "宝坻区" },
            { title: "滨海新区" },
            { title: "宁河区" },
            { title: "静海区" },
            { title: "蓟州区" },
          ],
        },
        {
          title: "河北省",
          children: [
            { title: "石家庄市" },
            { title: "唐山市" },
            { title: "秦皇岛市" },
            { title: "邯郸市" },
            { title: "邢台市" },
            { title: "保定市" },
            { title: "张家口市" },
            { title: "承德市" },
            { title: "沧州市" },
            { title: "廊坊市" },
            { title: "衡水市" },
          ],
        },
        {
          title: "山西省",
          children: [
            { title: "太原市" },
            { title: "大同市" },
            { title: "阳泉市" },
            { title: "长治市" },
            { title: "晋城市" },
            { title: "朔州市" },
            { title: "晋中市" },
            { title: "运城市" },
            { title: "忻州市" },
            { title: "临汾市" },
            { title: "吕梁市" },
          ],
        },
        {
          title: "内蒙古自治区",
          children: [
            { title: "呼和浩特市" },
            { title: "包头市" },
            { title: "乌海市" },
            { title: "赤峰市" },
            { title: "通辽市" },
            { title: "鄂尔多斯市" },
            { title: "呼伦贝尔市" },
            { title: "巴彦淖尔市" },
            { title: "乌兰察布市" },
            { title: "兴安盟" },
            { title: "锡林郭勒盟" },
            { title: "阿拉善盟" },
          ],
        },
        {
          title: "辽宁省",
          children: [
            { title: "沈阳市" },
            { title: "大连市" },
            { title: "鞍山市" },
            { title: "抚顺市" },
            { title: "本溪市" },
            { title: "丹东市" },
            { title: "锦州市" },
            { title: "营口市" },
            { title: "阜新市" },
            { title: "辽阳市" },
            { title: "盘锦市" },
            { title: "铁岭市" },
            { title: "朝阳市" },
            { title: "葫芦岛市" },
          ],
        },
        {
          title: "吉林省",
          children: [
            { title: "长春市" },
            { title: "吉林市" },
            { title: "四平市" },
            { title: "辽源市" },
            { title: "通化市" },
            { title: "白山市" },
            { title: "松原市" },
            { title: "白城市" },
            { title: "延边朝鲜族自治州" },
          ],
        },
        {
          title: "黑龙江省",
          children: [
            { title: "哈尔滨市" },
            { title: "齐齐哈尔市" },
            { title: "鸡西市" },
            { title: "鹤岗市" },
            { title: "双鸭山市" },
            { title: "大庆市" },
            { title: "伊春市" },
            { title: "佳木斯市" },
            { title: "七台河市" },
            { title: "牡丹江市" },
            { title: "黑河市" },
            { title: "绥化市" },
            { title: "大兴安岭地区" },
          ],
        },
        {
          title: "上海市",
          children: [
            { title: "黄浦区" },
            { title: "徐汇区" },
            { title: "长宁区" },
            { title: "静安区" },
            { title: "普陀区" },
            { title: "虹口区" },
            { title: "杨浦区" },
            { title: "闵行区" },
            { title: "宝山区" },
            { title: "嘉定区" },
            { title: "浦东新区" },
            { title: "金山区" },
            { title: "松江区" },
            { title: "青浦区" },
            { title: "奉贤区" },
            { title: "崇明区" },
          ],
        },
        {
          title: "江苏省",
          children: [
            { title: "南京市" },
            { title: "无锡市" },
            { title: "徐州市" },
            { title: "常州市" },
            { title: "苏州市" },
            { title: "南通市" },
            { title: "连云港市" },
            { title: "淮安市" },
            { title: "盐城市" },
            { title: "扬州市" },
            { title: "镇江市" },
            { title: "泰州市" },
            { title: "宿迁市" },
          ],
        },
        {
          title: "浙江省",
          children: [
            { title: "杭州市" },
            { title: "宁波市" },
            { title: "温州市" },
            { title: "嘉兴市" },
            { title: "湖州市" },
            { title: "绍兴市" },
            { title: "金华市" },
            { title: "衢州市" },
            { title: "舟山市" },
            { title: "台州市" },
            { title: "丽水市" },
          ],
        },
        {
          title: "安徽省",
          children: [
            { title: "合肥市" },
            { title: "芜湖市" },
            { title: "蚌埠市" },
            { title: "淮南市" },
            { title: "马鞍山市" },
            { title: "淮北市" },
            { title: "铜陵市" },
            { title: "安庆市" },
            { title: "黄山市" },
            { title: "滁州市" },
            { title: "阜阳市" },
            { title: "宿州市" },
            { title: "六安市" },
            { title: "亳州市" },
            { title: "池州市" },
            { title: "宣城市" },
          ],
        },
        {
          title: "福建省",
          children: [
            { title: "福州市" },
            { title: "厦门市" },
            { title: "莆田市" },
            { title: "三明市" },
            { title: "泉州市" },
            { title: "漳州市" },
            { title: "南平市" },
            { title: "龙岩市" },
            { title: "宁德市" },
          ],
        },
        {
          title: "江西省",
          children: [
            { title: "南昌市" },
            { title: "景德镇市" },
            { title: "萍乡市" },
            { title: "九江市" },
            { title: "新余市" },
            { title: "鹰潭市" },
            { title: "赣州市" },
            { title: "吉安市" },
            { title: "宜春市" },
            { title: "抚州市" },
            { title: "上饶市" },
          ],
        },
        {
          title: "山东省",
          children: [
            { title: "济南市" },
            { title: "青岛市" },
            { title: "淄博市" },
            { title: "枣庄市" },
            { title: "东营市" },
            { title: "烟台市" },
            { title: "潍坊市" },
            { title: "济宁市" },
            { title: "泰安市" },
            { title: "威海市" },
            { title: "日照市" },
            { title: "莱芜市" },
            { title: "临沂市" },
            { title: "德州市" },
            { title: "聊城市" },
            { title: "滨州市" },
            { title: "菏泽市" },
          ],
        },
        {
          title: "河南省",
          children: [
            { title: "郑州市" },
            { title: "开封市" },
            { title: "洛阳市" },
            { title: "平顶山市" },
            { title: "安阳市" },
            { title: "鹤壁市" },
            { title: "新乡市" },
            { title: "焦作市" },
            { title: "濮阳市" },
            { title: "许昌市" },
            { title: "漯河市" },
            { title: "三门峡市" },
            { title: "南阳市" },
            { title: "商丘市" },
            { title: "信阳市" },
            { title: "周口市" },
            { title: "驻马店市" },
            { title: "济源市" },
          ],
        },
        {
          title: "湖北省",
          children: [
            { title: "武汉市" },
            { title: "黄石市" },
            { title: "十堰市" },
            { title: "宜昌市" },
            { title: "襄阳市" },
            { title: "鄂州市" },
            { title: "荆门市" },
            { title: "孝感市" },
            { title: "荆州市" },
            { title: "黄冈市" },
            { title: "咸宁市" },
            { title: "随州市" },
            { title: "恩施土家族苗族自治州" },
            { title: "仙桃市" },
            { title: "潜江市" },
            { title: "天门市" },
            { title: "神农架林区" },
          ],
        },
        {
          title: "湖南省",
          children: [
            { title: "长沙市" },
            { title: "株洲市" },
            { title: "湘潭市" },
            { title: "衡阳市" },
            { title: "邵阳市" },
            { title: "岳阳市" },
            { title: "常德市" },
            { title: "张家界市" },
            { title: "益阳市" },
            { title: "郴州市" },
            { title: "永州市" },
            { title: "怀化市" },
            { title: "娄底市" },
            { title: "湘西土家族苗族自治州" },
          ],
        },
        {
          title: "广东省",
          children: [
            { title: "广州市" },
            { title: "韶关市" },
            { title: "深圳市" },
            { title: "珠海市" },
            { title: "汕头市" },
            { title: "佛山市" },
            { title: "江门市" },
            { title: "湛江市" },
            { title: "茂名市" },
            { title: "肇庆市" },
            { title: "惠州市" },
            { title: "梅州市" },
            { title: "汕尾市" },
            { title: "河源市" },
            { title: "阳江市" },
            { title: "清远市" },
            { title: "东莞市" },
            { title: "中山市" },
            { title: "潮州市" },
            { title: "揭阳市" },
            { title: "云浮市" },
          ],
        },
        {
          title: "广西壮族自治区",
          children: [
            { title: "南宁市" },
            { title: "柳州市" },
            { title: "桂林市" },
            { title: "梧州市" },
            { title: "北海市" },
            { title: "防城港市" },
            { title: "钦州市" },
            { title: "贵港市" },
            { title: "玉林市" },
            { title: "百色市" },
            { title: "贺州市" },
            { title: "河池市" },
            { title: "来宾市" },
            { title: "崇左市" },
          ],
        },
        {
          title: "海南省",
          children: [
            { title: "海口市" },
            { title: "三亚市" },
            { title: "三沙市" },
            { title: "儋州市" },
            { title: "五指山市" },
            { title: "琼海市" },
            { title: "文昌市" },
            { title: "万宁市" },
            { title: "东方市" },
            { title: "定安县" },
            { title: "屯昌县" },
            { title: "澄迈县" },
            { title: "临高县" },
            { title: "白沙黎族自治县" },
            { title: "昌江黎族自治县" },
            { title: "乐东黎族自治县" },
            { title: "陵水黎族自治县" },
            { title: "保亭黎族苗族自治县" },
            { title: "琼中黎族苗族自治县" },
          ],
        },
        {
          title: "重庆市",
          children: [
            { title: "万州区" },
            { title: "涪陵区" },
            { title: "渝中区" },
            { title: "大渡口区" },
            { title: "江北区" },
            { title: "沙坪坝区" },
            { title: "九龙坡区" },
            { title: "南岸区" },
            { title: "北碚区" },
            { title: "綦江区" },
            { title: "大足区" },
            { title: "渝北区" },
            { title: "巴南区" },
            { title: "黔江区" },
            { title: "长寿区" },
            { title: "江津区" },
            { title: "合川区" },
            { title: "永川区" },
            { title: "南川区" },
            { title: "璧山区" },
            { title: "铜梁区" },
            { title: "潼南区" },
            { title: "荣昌区" },
            { title: "开州区" },
            { title: "梁平区" },
            { title: "武隆区" },
            { title: "城口县" },
            { title: "丰都县" },
            { title: "垫江县" },
            { title: "忠县" },
            { title: "云阳县" },
            { title: "奉节县" },
            { title: "巫山县" },
            { title: "巫溪县" },
            { title: "石柱土家族自治县" },
            { title: "秀山土家族苗族自治县" },
            { title: "酉阳土家族苗族自治县" },
            { title: "彭水苗族土家族自治县" },
          ],
        },
        {
          title: "四川省",
          children: [
            { title: "成都市" },
            { title: "自贡市" },
            { title: "攀枝花市" },
            { title: "泸州市" },
            { title: "德阳市" },
            { title: "绵阳市" },
            { title: "广元市" },
            { title: "遂宁市" },
            { title: "内江市" },
            { title: "乐山市" },
            { title: "南充市" },
            { title: "眉山市" },
            { title: "宜宾市" },
            { title: "广安市" },
            { title: "达州市" },
            { title: "雅安市" },
            { title: "巴中市" },
            { title: "资阳市" },
            { title: "阿坝藏族羌族自治州" },
            { title: "甘孜藏族自治州" },
            { title: "凉山彝族自治州" },
          ],
        },
        {
          title: "贵州省",
          children: [
            { title: "贵阳市" },
            { title: "六盘水市" },
            { title: "遵义市" },
            { title: "安顺市" },
            { title: "毕节市" },
            { title: "铜仁市" },
            { title: "黔西南布依族苗族自治州" },
            { title: "黔东南苗族侗族自治州" },
            { title: "黔南布依族苗族自治州" },
          ],
        },
        {
          title: "云南省",
          children: [
            { title: "昆明市" },
            { title: "曲靖市" },
            { title: "玉溪市" },
            { title: "保山市" },
            { title: "昭通市" },
            { title: "丽江市" },
            { title: "普洱市" },
            { title: "临沧市" },
            { title: "楚雄彝族自治州" },
            { title: "红河哈尼族彝族自治州" },
            { title: "文山壮族苗族自治州" },
            { title: "西双版纳傣族自治州" },
            { title: "大理白族自治州" },
            { title: "德宏傣族景颇族自治州" },
            { title: "怒江傈僳族自治州" },
            { title: "迪庆藏族自治州" },
          ],
        },
        {
          title: "西藏自治区",
          children: [
            { title: "拉萨市" },
            { title: "日喀则市" },
            { title: "昌都市" },
            { title: "林芝市" },
            { title: "山南市" },
            { title: "那曲市" },
            { title: "阿里地区" },
          ],
        },
        {
          title: "陕西省",
          children: [
            { title: "西安市" },
            { title: "铜川市" },
            { title: "宝鸡市" },
            { title: "咸阳市" },
            { title: "渭南市" },
            { title: "延安市" },
            { title: "汉中市" },
            { title: "榆林市" },
            { title: "安康市" },
            { title: "商洛市" },
          ],
        },
        {
          title: "甘肃省",
          children: [
            { title: "兰州市" },
            { title: "嘉峪关市" },
            { title: "金昌市" },
            { title: "白银市" },
            { title: "天水市" },
            { title: "武威市" },
            { title: "张掖市" },
            { title: "平凉市" },
            { title: "酒泉市" },
            { title: "庆阳市" },
            { title: "定西市" },
            { title: "陇南市" },
            { title: "临夏回族自治州" },
            { title: "甘南藏族自治州" },
          ],
        },
        {
          title: "青海省",
          children: [
            { title: "西宁市" },
            { title: "海东市" },
            { title: "海北藏族自治州" },
            { title: "黄南藏族自治州" },
            { title: "海南藏族自治州" },
            { title: "果洛藏族自治州" },
            { title: "玉树藏族自治州" },
            { title: "海西蒙古族藏族自治州" },
          ],
        },
        {
          title: "宁夏回族自治区",
          children: [
            { title: "银川市" },
            { title: "石嘴山市" },
            { title: "吴忠市" },
            { title: "固原市" },
            { title: "中卫市" },
          ],
        },
        {
          title: "新疆维吾尔自治区",
          children: [
            { title: "乌鲁木齐市" },
            { title: "克拉玛依市" },
            { title: "吐鲁番市" },
            { title: "哈密市" },
            { title: "昌吉回族自治州" },
            { title: "博尔塔拉蒙古自治州" },
            { title: "巴音郭楞蒙古自治州" },
            { title: "阿克苏地区" },
            { title: "克孜勒苏柯尔克孜自治州" },
            { title: "喀什地区" },
            { title: "和田地区" },
            { title: "伊犁哈萨克自治州" },
            { title: "塔城地区" },
            { title: "阿勒泰地区" },
            { title: "石河子市" },
            { title: "阿拉尔市" },
            { title: "图木舒克市" },
            { title: "五家渠市" },
            { title: "铁门关市" },
          ],
        },
        { title: "香港", children: [{ title: "香港" }] },
        { title: "澳门", children: [{ title: "澳门" }] },
      ],
      Provincial: [],
      city: [], //城市
    };
  },
  mounted() {
    this.init();
    console.log(this.addressList);
  },
  methods: {
    initOrder: function () {
      // this.$http.post("/order/getDriverOrder", { pageNum: this.query.pageNum, pageSize: this.query.pageSize }).then(res => {
      this.$http.post("/order/getDriverOrder", this.Pagination).then((res) => {
        // console.log(res.data.object.list,1111);
        this.orders = res.data.object.list;
        this.Pagination.total = res.data.object.total;
      });
      for (let i in this.addressList) {
        if (this.Pagination.city === this.addressList[i].title) {
          this.city = this.addressList[i].children;
        }
      }
    },
    initProvincial() {
      this.Pagination.area = "";
      this.initOrder();
    },
    init() {
      this.loading = true;
      this.$http.post("/order/getDriverOrder", this.Pagination).then((res) => {
        console.log(res);
        this.orders = res.data.object.list;
        this.Pagination.total = res.data.object.total;
      });
      this.loading = false;
    },
    handleSizeChange(val) {
      this.Pagination.pageSize = val;
      this.init();
    },
    handleCurrentChange(val) {
      this.Pagination.pageNum = val;
      this.init();
    },
    chuanzhi(list) {
      this.centerDialogVisible = true;

      const newFoo = JSON.parse(JSON.stringify(list));
      this.tablelist = newFoo;

      if (list.merchantLicenseImg) {
        this.tablelist.merchantLicenseImg = JSON.parse(list.merchantLicenseImg);
      } else {
        this.tablelist.merchantLicenseImg = [];
      }
    },
    Submit() {
      this.tablelist.merchantLicenseImg = JSON.stringify(
        this.tablelist.merchantLicenseImg
      );
      this.$http
        .post("/order/updateDriverOrder", this.tablelist)
        .then((res) => {
          console.log(res);
          if (res.data.code) {
            this.$message({
              message: "恭喜你，这是一条成功消息",
              type: "success",
            });
          } else {
            this.$message.error("错了哦，这是一条错误消息");
          }
          this.centerDialogVisible = false;
        });
    },
    uploads(response) {
      console.log(this.tablelist.merchantLicenseImg);
      this.tablelist.merchantLicenseImg.push(response.object.url);
    },
    deletes(id) {
      this.$http
        .delete("/order/deleteDriverOrder", { params: { id } })
        .then((res) => {
          console.log(res);
          this.init();
        });
    },
    querySearch(stationName, cb) {
      this.$http
        .get("/testStation/getAllStation", {
          params: {
            stationName,
          },
        })
        .then((res) => {
          let results = [];
          res.data.object.list.forEach((item) => {
            results.push({ value: item.name, id: item.id });
          });
          cb(results);
        });
    },
    handleSelect(item) {
      this.Pagination.stationId = item.id;
      this.init();
    },
    querydriver(driverName, cb) {
      this.$http
        .get("/driverUser/getAllDriver", { params: { driverName } })
        .then((res) => {
          // console.log(res);
          let result = [];
          res.data.object.list.forEach((item) => {
            result.push({ value: item.driverName, id: item.id });
          });
          cb(result);
        });
    },
    handledriver(item) {
      this.Pagination.driverId = item.id;
      this.init();
    },
    OrderDetail(row, expandedRows) {
      this.$http
        .get("/order/getOrderDetail", { params: { id: row.id } })
        .then((res) => {
          if (expandedRows.length) {
            this.Orderlist = res.data.object;
            this.expandRows = [row.id];

            switch (this.Orderlist.serviceState) {
              case "预约":
                this.activevalue = 1;
                break;
              case "预检":
                this.activevalue = 2;
                break;
              case "送检":
                this.activevalue = 3;
                break;
              case "还车":
                this.activevalue = 4;
                break;
              case "归档":
                this.activevalue = 5;
                break;
              default:
                this.activevalue = 0;
                break;
            }
          } else {
            this.expandRows = [];
          }
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.el-image {
  width: 100px;
}
</style>